using Geekees.App.HRAssistant.DataInterface;
using Geekees.App.HRAssistant.DataInterface.Common;
using Geekees.App.HRAssistant.Core.Domain;
using Geekees.App.HRAssistant.Core.Utils;

namespace Geekees.App.HRAssistant.Data.NHibernateSessionMgmt
{
	/// <summary>
	/// Exposes access to NHibernate DAO classes.  Motivation for this DAO
	/// framework can be found at http://www.hibernate.org/328.html.
	/// </summary>
	public class NHibernateDaoFactory : IDaoFactory
	{
		public NHibernateDaoFactory( string sessionFactoryConfigPath )
		{
			Check.Require( sessionFactoryConfigPath != null, "sessionFactoryConfigPath may not be null" );
			SessionFactoryConfigPath = sessionFactoryConfigPath;
		}

		protected string SessionFactoryConfigPath
		{
			get
			{
				return sessionFactoryConfigPath;
			}
			set
			{
				sessionFactoryConfigPath = value;
			}
		}

		public IUserDao GetUserDao()
		{
			return new UserDao( sessionFactoryConfigPath );
		}

		private string sessionFactoryConfigPath;
	}
}
